package factory

type ShapeFactoryInterface interface {
	Create(param ShapeParam) Shape
}

type RectangleFactory struct {
}

func (r RectangleFactory) Create(param ShapeParam) Shape {
	return &Rectangle{
		width:  param.Width,
		height: param.Height,
	}
}

type CircleFactory struct {
}

func (c CircleFactory) Create(param ShapeParam) Shape {
	return &Circle{
		radius: param.Radius,
	}
}

// GetShapeFactoryByShapeType 生成对应工厂实现的工厂函数
func GetShapeFactoryByShapeType(shapeType string) ShapeFactoryInterface {
	switch shapeType {
	case "circle":
		return &CircleFactory{}
	case "rectangle":

		return &RectangleFactory{}
	default:
		return nil
	}
}
